<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>网站信息</title>
    <link rel="stylesheet" href="__CSS__/pintuer.css">
    <link rel="stylesheet" href="__CSS__/admin.css">
    <link rel="stylesheet" href="__STATIC__/css/layui.css">
    <script src="__STATIC__/layui.js"></script>
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder">流程列表</strong>&emsp;<a style="color: #3a4bfb;font-weight: bold "
                                                                               href="javascript:history.go(-1)">返回上一步</a>
    </div>
    <div class="padding border-bottom">
        <!--<a class="button border-yellow" href=""><span class="icon-plus-square-o"></span> 添加内容</a>-->
    </div>
    <form action="{:url('Flow/flowlist')}" method="post" class="layui-form">
        <div class="layui-form-item">
            <div style="margin-top: 1%" class="layui-inline">
                <div style="margin-left: 15%" class="layui-input-inline">
                    <input style="margin-bottom: 1%" name="sousuo" placeholder="输入搜索的流程ID/名称" class="layui-input" type="text">
                    <button style="margin-top: 5%" name="submit" value="submit" class="layui-btn" lay-submit=""
                            lay-filter="demo">立即搜索
                    </button>
                    <button style="margin-top: 5%" type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </div>
    </form>
    <table lay-filter="table">
        <thead>
        <tr>
            <th lay-data="{field:'id',sort:'true', align:'center'}">审批流ID</th>
            <th lay-data="{field:'region_id', align:'center'}">主体</th>
            <th lay-data="{field:'branch_id', align:'center'}">部门</th>
            <th lay-data="{field:'bill_type_id', align:'center'}">单据名称</th>
            <th lay-data="{field:'details'}">流程详情</th>
            <th lay-data="{fixed: 'right', width:250, align:'center', toolbar: '#barDemo'}">操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr>
            <td>{$vo.id}</td>
            <td>{$vo.region}</td>
            <td>{$vo.branch}</td>
            <td>{$vo.type_approve}</td>
            <td>{$vo.detials}</td>
            <td lay-data="{fixed: 'right', width:178, align:'center', toolbar: '#barDemo'}">

            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
</div>
<div>
</div>
</body>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">流程详情</a>
    <a class="layui-btn layui-btn-xs" lay-event="edit">修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
    layui.use(['table', 'layer', 'form'], function () {
        var table = layui.table
            , layer = layui.layer
            , form = layui.form;
        //加载
        var index = layer.load(1, {time: 10*1000});
        //关闭
        layer.close(index);
        table.on('tool(table)', function (obj) {
            var data = obj.data;
            if (obj.event === 'detail') {
                layer.msg('审批详情：' + data.details);
            } else if (obj.event === 'del') {
                del(data.id);
            } else if (obj.event === 'edit') {
                window.location.href = "{:url('Flow/flowsave')}" + "?id=" + data.id;
                //layer.alert('编辑行：<br>'+ JSON.stringify(data))
            }
        });
        table.init('table', {
            height: 400 //设置高度
            //注意：请务必确保 limit 参数（默认：10）是与你服务端限定的数据条数一致
//支持所有基础参数
            , page: {
                layout: ['limit', 'count', 'prev', 'page', 'next', 'skip']
                , curr: 1
            }
        });
    });
    function del(id) {
        layui.use(['layer'], function () {
            var layer = layui.layer;
            layer.confirm('你确定要删除吗', {icon: 7, title: '提示'}, function (index) {
                var submit = "submit";
                $.ajax({
                    type: "post",
                    url: "{:url('Flow/flowdel')}",
                    data: {"id": id, 'submit': submit},
                    dataType: "json",
                    success: function (a) {
                        //alert(10);
                        if (a) {
                            layer.msg('删除成功', {icon: 1});
                            layer.close(index);
                        } else {
                            layer.msg('删除失败', {icon: 2});
                            layer.close(index);
                        }
                        setTimeout(function () {
                            //使用  setTimeout（）方法设定定时2000<a href="https://www.baidu.com/s?wd=%E6%AF%AB%E7%A7%92&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWuHn4n1DkmynYmhu9uhcd0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHf4PWmsrHRdnWckPWnkrHmkrf" target="_blank" class="baidu-highlight">毫秒</a>
                            window.location.reload();//页面刷新
                        }, 2000);
                    }

                })
            })

        });
    }
</script>
</html>